/*
 *  Copyright (c) 2014 ZengYajian
 *
 *  Simple log module for c.
 *  by ZengYajian
 */

#ifndef __log_h__
#define __log_h__

#include <stdio.h>
#include <pthread.h>

#define _LOG_PATH_LEN	(256)
#define _LOG_BUFFSIZE	(1024*1024*4)

enum loglevel {
	ERROR	= 0,
	WARNING	= 1,
	NOTICE	= 2,
	TRACE	= 3,
	DEBUG	= 4,
};

struct logger {
	enum loglevel setting_loglevel;
	char location[_LOG_PATH_LEN];
	FILE *log_file;
	char buffer[_LOG_BUFFSIZE];
};


int log_init(enum loglevel l, const char *name, const char *path);
int _log(enum loglevel l, char *logformat,...);

#endif
